package com.yindian.cos.easy.security.properties;

import lombok.Data;

/**
 * token配置
 *
 * @author zhangchuanhao
 * @create 2018/11/21
 */
@Data
public class TokenProperties {

    /**
     * access token过期时间(秒) 默认30分钟
     */
    private int accessTokenExpire = 60 * 30;

    /**
     * refresh token过期时间(秒) 默认一个小时
     */
    private int refreshTokenExpire = accessTokenExpire * 2;

    /**
     * jwt的SecretKey
     */
    private String jwtSecretKey = "easy-security";

    /**
     * jwt主题
     */
    private String subject = "easy-security";

    public TokenProperties() {
        if (accessTokenExpire >= refreshTokenExpire) {
            throw new RuntimeException("access token expire Can't be greater than or equal to refresh token expire");
        }
    }
}
